package me.guitar.restweb;

import org.eclipse.jetty.server.handler.ErrorHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;

public class NoContentOutputErrorHandler extends ErrorHandler {
    
    boolean _showStacks = false;
    
    public NoContentOutputErrorHandler() {
        super();
    }
    
    @Override
    protected void handleErrorPage(HttpServletRequest request, Writer writer, int code,
                                   String message) throws IOException {
        writeErrorPage(request, writer, code, message, _showStacks);
    }
    
    @Override
    protected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message,
                                  boolean showStacks) throws IOException {
        
        // we don't want any Jetty output
        
    }
    
    @Override
    protected void writeErrorPageHead(HttpServletRequest request, Writer writer, int code,
                                      String message) throws IOException {
        // we don't want any Jetty output
        
    }
    
    @Override
    protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code,
                                      String message, boolean showStacks) throws IOException {
        // we don't want any Jetty output
        
    }
    
    @Override
    protected void writeErrorPageMessage(HttpServletRequest request, Writer writer, int code,
                                         String message, String uri) throws IOException {
        // we don't want any Jetty output
        
    }
    
    @Override
    protected void writeErrorPageStacks(HttpServletRequest request, Writer writer)
        throws IOException {
        // we don't want any stack output
        
    }
}
